package main

import "fmt"

//固定长度的数组 只能传递固定值的数组长度 不太适合开发
func printArray(myarray3 [4]int) {
	//相当于 值拷贝 完全拷贝了一份
	for index, value := range myarray3 {
		fmt.Println("index = ", index, ", value = ", value)
	}
	myarray3[0] = 111
}

func main() {
	var myarray1 [10]int

	myarray2 := [10]int{1, 2, 3, 4}
	myarray3 := [4]int{11, 22, 33, 44}

	for i := 0; i < len(myarray1); i++ {
		fmt.Println(myarray1[i])
	}

	for index, value := range myarray2 {
		fmt.Println("index = ", index, ", value = ", value)
	}

	//查看数组的数据类型
	fmt.Printf("myArray1 types = %T\n", myarray1)
	fmt.Printf("myArray2 types = %T\n", myarray2)
	fmt.Printf("myArray3 types = %T\n", myarray3)

	printArray(myarray3)
	fmt.Println(" ------ ")
	for index, value := range myarray3 {
		fmt.Println("index = ", index, ", value = ", value)
	}
}
